package com.wlyuan.open.scanner.application.handler.full;

import com.wlyuan.open.dto.OpenCustomerSyncDTO;
import com.wlyuan.open.scanner.application.annotation.ScannerCode;
import com.wlyuan.open.scanner.assembler.ScannerCustomerAssembler;
import com.wlyuan.open.scanner.constant.ScannerCodeEnum;
import com.wlyuan.open.scanner.domain.customer.Customer;
import com.wlyuan.open.scanner.repository.CustomerRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lijing
 * @description
 */
@ScannerCode(code = ScannerCodeEnum.CUSTOMER)
@Service
@Slf4j
@RequiredArgsConstructor
public class ScannerCustomerHandler extends BaseScannerHandler<Customer, OpenCustomerSyncDTO> {
    private final CustomerRepository customerRepository;

    @Override
    protected List<Customer> select() {
        return customerRepository.list();
    }

    @Override
    protected List<OpenCustomerSyncDTO> assembler(List<Customer> data) {
        return ScannerCustomerAssembler.assemble(data);
    }

}
